home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1997 #3
/
Amiga Plus CD - 1997 - No. 03.iso
/
pd
/
programmierung
/
alienbreed3d2_src
/
cheesesauce
/
anims.bak
< prev
next >
Wrap
Text File
|
1997-01-31
|
48KB
|
3,330 lines
Flash:
; D0=number of a zone, D1=brightness change
movem.l d0/a0/a1,-(a7)
move.l #ZoneBrightTable,a1
add.w d1,(a1,d0.w*4)
add.w d1,2(a1,d0.w*4)
move.l ZoneAdds,a0
move.l (a0,d0.w*4),a0
add.l LEVELDATA,a0
add.l #ToListOfGraph,a0
doemall:
move.w (a0),d0
blt.s doneemall
add.w d1,(a1,d0.w*4)
add.w d1,2(a1,d0.w*4)
addq #8,a0
bra.s doemall
doneemall:
movem.l (a7)+,d0/a0/a1
rts
ExplodeIntoBits:
move.l NastyShotData,a5
move.w #19,d1
.findeight
move.w 12(a5),d0
blt.s .gotonehere
adda.w #64,a5
dbra d1,.findeight
rts
.gotonehere
move.l ObjectPoints,a2
move.w (a5),d3
lea (a2,d3.w*8),a2
move.w newx,(a2)
move.w newz,4(a2)
jsr GetRand
and.w #8190,d0
move.l #SineTable,a2
adda.w d0,a2
move.w (a2),d3
move.w 2048(a2),d4
Jsr GetRand
and.w #3,d0
add.w #1,d0
ext.l d3
ext.l d4
asl.l d0,d3
asl.l d0,d4
move.l ImpactX(a0),d0
swap d4
asr.w #1,d0
add.w d0,d4
swap d0
move.w d4,shotzvel(a5)
swap d3
asr.w #1,d0
add.w d0,d3
move.w d3,shotxvel(a5)
jsr GetRand
and.w #1023,d0
add.w #2*128,d0
neg.w d0
move.w d0,shotyvel(a5)
move.l #0,EnemyFlags(a5)
move.w 12(a0),12(a5)
move.w 4(a0),d0
add.w #6,d0
ext.l d0
asl.l #7,d0
move.l d0,accypos(a5)
move.w d2,d0
and.w #3,d0
add.w #50,d0
move.b d0,shotsize(a5)
move.w #40,shotgrav(a5)
move.w #0,shotflags(a5)
move.w #-1,shotlife(a5)
clr.b shotstatus(a5)
move.b ObjInTop(a0),ObjInTop(a5)
st worry(a0)
adda.w #64,a5
sub.w #1,d2
blt.s .gotemall
dbra d1,.findeight
.gotemall
rts
brightanim:
move.l #BrightAnimTable,a1
move.l #BrightAnimPtrs,a3
move.l #BrightAnimStarts,a4
dobrightanims
move.l (a3),d0
blt nomoreanims
move.l d0,a2
move.w (a2)+,d0
cmp.w #999,d0
bne.s itsabright
move.l (a4),a2
move.w (a2)+,d0
itsabright:
move.l a2,(a3)+
addq #4,a4
move.w d0,(a1)+
bra.s dobrightanims
nomoreanims:
rts
BrightAnimTable: ds.w 20
BrightAnimPtrs:
dc.l PulseANIM
dc.l FlickerANIM
dc.l FireFlickerANIM
dc.l -1
BrightAnimStarts:
dc.l PulseANIM
dc.l FlickerANIM
dc.l FireFlickerANIM
PulseANIM:
dc.w -10,-10,-9,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10
dc.w 10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9
dc.w 999
FlickerANIM:
dcb.w 20,10
dc.w -10
dcb.w 30,10
dc.w -10
dcb.w 5,10
dc.w -10
dc.w 999
FireFlickerANIM:
dc.w -10,-9,-6,-10,-6,-5,-5,-7,-5,-10,-9,-8,-7,-5,-5,-5,-5
dc.w -5,-5,-5,-5,-6,-7,-8,-9,-5,-10,-9,-10,-6,-5,-5,-5,-5,-5
dc.w -5,-5
dc.w 999
realtab:
dc.l prot1-78935450
dc.l prot2-78935450
dc.l prot3-78935450
dc.l prot4-78935450
dc.l prot5-78935450
dc.l prot6-78935450
dc.l prot7-78935450
dc.l prot8-78935450
dc.l prot9-78935450
dc.l protA-78935450
objvels: ds.l 8
Robotanimpos:
dc.w 0
Robotarmpos
dc.w 0
clump: dc.w 0
RobotWalk:
move.l #RobotPts+2,a0
move.l #Robotanim,a1
move.w Robotanimpos(pc),d0
clr.b clump
adda.w d0,a1
move.w #(38*3)-1,d0
putinpts:
move.w (a1)+,(a0)+
dbra d0,putinpts
move.l #RightArm,a0
move.l #Armanim,a1
move.w Robotarmpos(pc),d0
adda.w d0,a1
move.w #(14*3)-1,d0
putinpts2:
move.w (a1)+,(a0)+
dbra d0,putinpts2
move.l #Robot_MainBody,a0
move.l #BodyPlace+2,a1
move.w (a0)+,d0
move.w RobotPts+4+14*6,d1
add.w RobotPts+4+22*6,d1
asr.w #1,d1
putinheights:
move.w (a0)+,d2
add.w d1,d2
move.w d2,(a1)
addq #6,a1
dbra d0,putinheights
move.w visxpos,d0
add.w visxdir,d0
cmp.w #24,d0
blt.s okvisr
move.w #-4,visxdir
okvisr
cmp.w #-24,d0
bgt.s okvisl
move.w #4,visxdir
okvisl:
move.w d0,visxpos
move.l #VISOR,a0
add.w #64,d0
move.b d0,6(a0)
move.b d0,18(a0)
move.b d0,22(a0)
add.b #63,d0
move.b d0,10(a0)
move.b d0,14(a0)
rts
visxpos: dc.w 0
visxdir: dc.w 4
FramesToDraw: dc.w 0
TempFrames: dc.w 0
objmoveanim:
move.l PLR1_Roompt,a0
move.w (a0),PLR1_Zone
move.l PLR2_Roompt,a0
move.w (a0),PLR2_Zone
bsr Player1Shot
bsr Player2Shot
bsr SwitchRoutine
bsr DoorRoutine
bsr LiftRoutine
bsr ObjectHandler
bsr RobotWalk
bsr brightanim
subq.w #1,animtimer
bgt.s notzero
move.w #2,animtimer
move.l otherrip,d0
move.l RipTear,otherrip
move.l d0,RipTear
notzero:
rts
******************************
tstdir: dc.w 0
liftheighttab: ds.w 40
doorheighttab: ds.w 40
PLR1_stoodonlift: dc.b 0
PLR2_stoodonlift: dc.b 0
liftattop: dc.b 0
liftatbot: dc.b 0
ZoneBrightTable:
ds.l 300
even
LiftRoutine:
move.l LiftData,a0
move.l #liftheighttab,a6
doalift:
move.w (a0)+,d0 ; bottom of lift movement
cmp.w #999,d0
bne notallliftsdone
move.w #999,(a6)
rts
notallliftsdone:
move.w (a0)+,d1 ; top of lift movement.
move.w (a0),d3
move.w d3,(a6)+
move.w 2(a0),d2
move.w d2,d7
muls TempFrames,d2
add.w d2,d3
move.w 2(a0),d2
cmp.w d3,d0
sle.s liftatbot
bgt.s .nolower
moveq #0,d2
move.w d0,d3
.nolower:
cmp.w d3,d1
sge.s liftattop
blt.s .noraise
moveq #0,d2
move.w d1,d3
.noraise:
sub.w d3,d0
cmp.w #15*16,d0
slt d6
move.w d3,(a0)+
move.l a0,a5
move.w d2,(a0)+
move.w d2,d7
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
asr.w #2,d3
move.w d3,d0
asl.w #2,d0
move.w d0,2(a1)
move.w d3,d0
muls #256,d3
move.w (a0)+,d5
move.l ZoneAdds,a1
move.l (a1,d5.w*4),a1
add.l LEVELDATA,a1
move.w (a1),d5
move.l PLR1_Roompt,a3
move.l d3,2(a1)
neg.w d0
cmp.w (a3),d5
seq.s PLR1_stoodonlift
move.l PLR2_Roompt,a3
cmp.w (a3),d5
seq.s PLR2_stoodonlift
move.w (a0)+,d2 ; conditions
and.w Conditions,d2
cmp.w -2(a0),d2
beq.s .satisfied
move.w (a0)+,d5
.dothesimplething:
move.l FloorLines,a3
.simplecheck:
move.w (a0)+,d5
blt nomoreliftwalls
asl.w #4,d5
lea (a3,d5.w),a4
move.w #0,14(a4)
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
move.l (a0)+,a2
adda.w d0,a2
move.l a2,10(a1)
move.l d3,20(a1)
bra.s .simplecheck
bra nomoreliftwalls
.satisfied:
move.l FloorLines,a3
moveq #0,d4
moveq #0,d5
move.b (a0)+,d4
move.b (a0)+,d5
tst.b liftattop
bne tstliftlower
tst.b liftatbot
bne tstliftraise
move.w #0,d1
backfromlift
and.w #255,d0
liftwalls:
move.w (a0)+,d5
blt nomoreliftwalls
asl.w #4,d5
lea (a3,d5.w),a4
move.w 14(a4),d4
move.w #$8000,14(a4)
and.w d1,d4
beq.s .nothinghit
move.w d7,(a5)
move.w #0,Noisex
move.w #0,Noisez
move.w #50,Noisevol
move.w #5,Samplenum
move.b #1,chanpick
st notifplaying
move.b #$fe,IDNUM
movem.l a0/a3/a4/d0/d1/d2/d3/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/a4/d0/d1/d2/d3/d6/d7
.nothinghit:
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
move.l (a0)+,a2
adda.w d0,a2
move.l a2,10(a1)
move.l d3,20(a1)
bra liftwalls
nomoreliftwalls
bra doalift
rts
tstliftlower:
cmp.b #1,d5
blt.s lift0
beq.s lift1
cmp.b #3,d5
blt.s lift2
beq.s lift3
lift0:
moveq #0,d1
tst.b p1_spctap
beq.s .noplr1
move.w #%100000000,d1
move.w #4,d7
tst.b PLR1_stoodonlift
beq.s .noplr1
move.w #$8000,d1
bra backfromlift
.noplr1:
tst.b p2_spctap
beq.s .noplr2
or.w #%100000000000,d1
move.w #4,d7
tst.b PLR2_stoodonlift
beq.s .noplr2
move.w #$8000,d1
bra backfromlift
.noplr2:
bra backfromlift
lift1:
move.w #4,d7
tst.b PLR1_stoodonlift
bne.s lift1b
tst.b PLR2_stoodonlift
bne.s lift1b
move.w #%100100000000,d1
bra backfromlift
lift1b:
move.w #$8000,d1
bra backfromlift
lift2:
move.w #$8000,d1
move.w #4,d7
bra backfromlift
lift3:
move.w #$0,d1
bra backfromlift
tstliftraise:
cmp.b #1,d4
blt.s rlift0
beq.s rlift1
cmp.b #3,d4
blt.s rlift2
beq.s rlift3
rlift0:
moveq #0,d1
tst.b p1_spctap
beq.s .noplr1
move.w #%100000000,d1
move.w #-4,d7
tst.b PLR1_stoodonlift
beq.s .noplr1
move.w #$8000,d1
bra backfromlift
.noplr1:
tst.b p2_spctap
beq.s .noplr2
or.w #%100000000000,d1
move.w #-4,d7
tst.b PLR2_stoodonlift
beq.s .noplr2
move.w #$8000,d1
bra backfromlift
.noplr2:
bra backfromlift
rlift1:
move.w #-4,d7
tst.b PLR1_stoodonlift
bne.s rlift1b
tst.b PLR2_stoodonlift
bne.s rlift1b
move.w #%100100000000,d1
bra backfromlift
rlift1b:
move.w #$8000,d1
bra backfromlift
rlift2:
move.w #$8000,d1
move.w #-4,d7
bra backfromlift
rlift3:
move.w #$0,d1
bra backfromlift
animtimer: dc.w 2
doordir: dc.w -1
doorpos: dc.w -9
dooropen: dc.b 0
doorclosed: dc.b 0
even
DoorRoutine:
move.l #doorheighttab,a6
move.l DoorData,a0
doadoor:
move.w (a0)+,d0 ; bottom of door movement
cmp.w #999,d0
bne notalldoorsdone
move.w #999,(a6)+
rts
notalldoorsdone:
move.w (a0)+,d1 ; top of door movement.
move.w (a0),d3
move.w d3,(a6)+
move.w 2(a0),d2
muls TempFrames,d2
add.w d2,d3
move.w 2(a0),d2
cmp.w d3,d0
sle.s doorclosed
bgt.s nolower
moveq #0,d2
nolower:
cmp.w d3,d1
sge.s dooropen
blt.s noraise
moveq #0,d2
move.w d1,d3
noraise:
sub.w d3,d0
cmp.w #15*16,d0
sge d6
move.w d3,(a0)+
move.l a0,a5
move.w d2,(a0)+
move.w d2,d7
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
asr.w #2,d3
move.w d3,d0
asl.w #2,d0
move.w d0,2(a1)
move.w d3,d0
muls #256,d3
move.l ZoneAdds,a1
move.w (a0)+,d5
move.l (a1,d5.w*4),a1
add.l LEVELDATA,a1
move.l d3,6(a1)
neg.w d0
and.w #255,d0
; add.w #64,d0
cmp.w PLR1_Zone,d5
bne.s NotGoBackUp
tst.b dooropen
bne.s NotGoBackUp
tst.w d2
blt.s NotGoBackUp
move.w #-16,d7
move.w #$8000,d1
move.w (a0)+,d2
move.w (a0)+,d5
bra backfromtst
NotGoBackUp:
move.w (a0)+,d2 ; conditions
and.w Conditions,d2
cmp.w -2(a0),d2
beq.s satisfied
move.w (a0)+,d5
dothesimplething:
move.l FloorLines,a3
simplecheck:
move.w (a0)+,d5
blt nomoredoorwalls
asl.w #4,d5
lea (a3,d5.w),a4
move.w #0,14(a4)
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
move.l (a0)+,a2
adda.w d0,a2
move.l a2,10(a1)
move.l d3,24(a1)
bra.s simplecheck
bra nomoredoorwalls
satisfied:
moveq #0,d4
moveq #0,d5
move.b (a0)+,d5
move.b (a0)+,d4
tst.b dooropen
bne tstdoortoclose
tst.b doorclosed
bne tstdoortoopen
move.w #$0,d1
backfromtst:
move.l FloorLines,a3
doorwalls:
move.w (a0)+,d5
blt.s nomoredoorwalls
asl.w #4,d5
lea (a3,d5.w),a4
move.w 14(a4),d4
move.w #$8000,14(a4)
and.w d1,d4
beq.s nothinghit
move.w d7,(a5)
move.w #0,Noisex
move.w #0,Noisez
move.w #50,Noisevol
move.w #5,Samplenum
move.b #1,chanpick
clr.b notifplaying
move.b #$fd,IDNUM
movem.l a0/a3/d0/d1/d2/d3/d6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/d0/d1/d2/d3/d6
nothinghit:
move.l (a0)+,a1
add.l LEVELGRAPHICS,a1
move.l (a0)+,a2
adda.w d0,a2
move.l a2,10(a1)
move.l d3,24(a1)
bra.s doorwalls
nomoredoorwalls
bra doadoor
rts
tstdoortoopen:
cmp.w #1,d5
blt.s door0
beq.s door1
cmp.w #3,d5
blt.s door2
beq.s door3
cmp.w #5,d5
blt.s door4
beq.s door5
door0:
move.w #$0,d1
tst.b p1_spctap
beq.s .noplr1
move.w #%100000000,d1
.noplr1:
tst.b p2_spctap
beq.s .noplr2
or.w #%100000000000,d1
.noplr2:
move.w #-16,d7
bra backfromtst
door1:
move.w #%100100000000,d1
move.w #-16,d7
bra backfromtst
door2:
move.w #%10000000000,d1
move.w #-16,d7
bra backfromtst
door3:
move.w #%1000000000,d1
move.w #-16,d7
bra backfromtst
door4:
move.w #$8000,d1
move.w #-16,d7
bra backfromtst
door5:
move.w #$0,d1
bra backfromtst
tstdoortoclose:
tst.w d4
beq.s dclose0
bra.s dclose1
dclose0:
move.w #4,d7
move.w #$8000,d1
bra backfromtst
dclose1:
move.w #$0,d1
bra backfromtst
SwitchRoutine:
tst.b p1_spctap
bne.s SpaceIsPressed
rts
SpaceIsPressed:
move.l SwitchData,a0
move.w #7,d0
move.l Points,a1
move.w PLR1_xoff,d1
move.w PLR1_zoff,d2
CheckSwitches:
move.w (a0),d3
blt NotCloseEnough
move.w 2(a0),d3
lea (a1,d3.w*4),a2
move.w (a2),d3
add.w 4(a2),d3
asr.w #1,d3
move.w 2(a2),d4
add.w 6(a2),d4
asr.w #1,d4
sub.w d1,d3
muls d3,d3
sub.w d2,d4
muls d4,d4
add.l d3,d4
cmp.l #60*60,d4
bge NotCloseEnough
move.l 4(a0),a3
add.l LEVELGRAPHICS,a3
move.w 2(a3),d3
and.w #%1111000000111111,d3
not.b 8(a0)
beq.s switchoff
or.w #32*64,d3
switchoff:
move.w d3,2(a3)
move.w #7,d3
sub.w d0,d3
addq #4,d3
move.w Conditions,d4
bchg d3,d4
move.w d4,Conditions
movem.l a0/a1/d0,-(a7)
move.w #0,Noisex
move.w #0,Noisez
move.w #50,Noisevol
move.w #10,Samplenum
move.b #1,chanpick
st notifplaying
move.b #$fc,IDNUM
movem.l a0/a3/d0/d1/d2/d3/d6,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a3/d0/d1/d2/d3/d6
movem.l (a7)+,a0/a1/d0
NotCloseEnough:
adda.w #12,a0
dbra d0,CheckSwitches
rts
prot1: dc.w 0
tempGotBigGun: dc.w 0
tempGunDamage: dc.w 0
tempGunNoise: dc.w 1
tempxoff: dc.w 0
tempzoff: dc.w 0
tempRoompt: dc.l 0
PLR1_GotBigGun: dc.w 0
PLR1_GunDamage: dc.w 0
PLR1_GunNoise: dc.w 0
PLR2_GotBigGun: dc.w 0
PLR2_GunDamage: dc.w 0
PLR2_GunNoise: dc.w 0
bulyspd: dc.w 0
closedist: dc.w 0
PLR1_ObsInLine:
ds.b 400
PLR2_ObsInLine:
ds.b 400
rotcount:
dc.w 0
shotvels: ds.l 20
PLR1_clicked: dc.b 0
PLR2_clicked: dc.b 0
popping: ds.l 5*4
targetydiff: dc.l 0
PLR1_TimeToShoot: dc.w 0
PLR2_TimeToShoot: dc.w 0
Player1Shot:
tst.w PLR1_TimeToShoot
beq.s okcanfire
move.w TempFrames,d0
sub.w d0,PLR1_TimeToShoot
bge PLR1_nofire
move.w #0,PLR1_TimeToShoot
bra PLR1_nofire
okcanfire:
lea PLR1_GunData,a6
moveq #0,d0
move.b p1_gunselected,d0
move.b d0,tempgun
lsl.w #2,d0
lea (a6,d0.w*8),a6
move.w 14(a6),BulletSpd
tst.w 12(a6)
beq.s .itsaclick
tst.b p1_fire
beq PLR1_nofire
bra .itsahold
.itsaclick:
tst.b p1_clicked
beq PLR1_nofire
.itsahold:
move.w PLR1_angpos,d0
move.l #SineTable,a0
lea (a0,d0.w),a0
move.w (a0),tempxdir
move.w 2048(a0),tempzdir
move.w PLR1_xoff,tempxoff
move.w PLR1_zoff,tempzoff
move.l PLR1_yoff,tempyoff
move.b PLR1_StoodInTop,tempStoodInTop
move.l PLR1_Roompt,tempRoompt
move.l #%110111000001,d7
move.w #-1,d0
move.l #0,targetydiff
move.l #$7fff,d1
move.l ZoneAdds,a3
move.l #PLR1_ObsInLine,a1
move.l ObjectData,a0
move.l #PLR1_ObjDists,a2
findclosestinline
tst.w (a0)
blt outofline
tst.b (a1)+
beq.s notlinedup
btst #0,17(a0)
beq.s notlinedup
tst.w 12(a0)
blt.s notlinedup
move.b 16(a0),d6
btst d6,d7
beq.s notlinedup
tst.b numlives(a0)
beq.s notlinedup
move.w (a0),d5
move.w (a2,d5.w*2),d6
move.w 4(a0),d2
ext.l d2
asl.l #7,d2
sub.l PLR1_yoff,d2
move.l d2,d3
bge.s .oknotneg
neg.l d2
.oknotneg:
divs #40,d2
cmp.w d6,d2
bgt.s notlinedup
cmp.w d6,d1
blt.s notlinedup
move.w d6,d1
; We have a closer enemy lined up.
move.l d3,targetydiff
move.w d5,d0
notlinedup:
add.w #64,a0
bra findclosestinline
outofline:
move.w #0,bulyspd
tst.w d0
blt nothingtoshoot
move.l targetydiff,d5
sub.l PLR1_height,d5
add.l #18*256,d5
move.w d1,closedist
move.w BulletSpd,d2
asr.w d2,d1
tst.w d1
bgt.s okdistthing
moveq #1,d1
okdistthing
divs d1,d5
move.w d5,bulyspd
tst.b 5(a6)
beq pressedfire
move.w (a6),d2
moveq #0,d1
move.b 2(a6),d1
cmp.w d1,d2
bge.s .okcanshoot
move.l PLR1_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.b #12,Samplenum+1
clr.b notifplaying
move.b #$fb,IDNUM
jsr MakeSomeNoise
rts
.okcanshoot:
move.w 8(a6),PLR1_TimeToShoot
move.b #2,PLR1_GunFrame
sub.w d1,d2
move.w d2,(a6)
; Just blow it up.
move.l PlayerShotData,a0
move.w #19,d1
.findonefree
move.w 12(a0),d2
blt.s .foundonefree
adda.w #64,a0
dbra d1,.findonefree
rts
.foundonefree:
move.l ObjectPoints,a1
move.w (a0),d2
move.l (a1,d0.w*8),(a1,d2.w*8)
move.l 4(a1,d0.w*8),4(a1,d2.w*8)
move.b #1,shotstatus(a0)
move.w #0,shotgrav(a0)
move.b p1_gunselected,shotsize(a0)
move.b #0,shotanim(a0)
move.l ObjectData,a1
asl.w #6,d0
adda.w d0,a1
move.w 4(a1),d1
ext.l d1
asl.l #7,d1
move.l d1,accypos(a0)
move.w 12(a1),12(a0)
st worry(a0)
move.w 4(a1),4(a0)
move.b 6(a6),d0
add.b d0,damagetaken(a1)
move.l PLR1_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.b 3(a6),Samplenum+1
move.b #2,chanpick
clr.b notifplaying
movem.l a0/d5/d6/d7,-(a7)
move.b #$fb,IDNUM
jsr MakeSomeNoise
movem.l (a7)+,a0/d5/d6/d7
rts
nothingtoshoot:
tst.b 5(a6)
beq pressedfire
move.w (a6),d0
moveq #0,d1
move.b 2(a6),d1
cmp.w d1,d0
bge.s .okcanshoot
move.l PLR1_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.b #12,Samplenum+1
clr.b notifplaying
move.b #$fb,IDNUM
jsr MakeSomeNoise
rts
.okcanshoot:
move.w 8(a6),PLR1_TimeToShoot
sub.w d1,d0
move.w d0,(a6)
move.b #2,PLR1_GunFrame
move.l PLR1_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.b 3(a6),Samplenum+1
move.b #2,chanpick
clr.b notifplaying
movem.l a0/d5/d6/d7,-(a7)
move.b #$fb,IDNUM
jsr MakeSomeNoise
movem.l (a7)+,a0/d5/d6/d7
rts
PLR1_nofire:
rts
BulletSpd: dc.w 0
*******************************************************
Player2Shot:
tst.w PLR2_TimeToShoot
beq.s okcanfire2
move.w TempFrames,d0
sub.w d0,PLR2_TimeToShoot
bge PLR2_nofire
move.w #0,PLR2_TimeToShoot
bra PLR2_nofire
okcanfire2:
lea PLR2_GunData,a6
moveq #0,d0
move.b p2_gunselected,d0
move.b d0,tempgun
lsl.w #2,d0
lea (a6,d0.w*8),a6
move.w 14(a6),BulletSpd
tst.w 12(a6)
beq.s .itsaclick
tst.b p2_fire
beq PLR2_nofire
bra .itsahold
.itsaclick:
tst.b p2_clicked
beq PLR2_nofire
.itsahold:
move.w PLR2_angpos,d0
move.l #SineTable,a0
lea (a0,d0.w),a0
move.w (a0),tempxdir
move.w 2048(a0),tempzdir
move.w PLR2_xoff,tempxoff
move.w PLR2_zoff,tempzoff
move.l PLR2_yoff,tempyoff
move.b PLR2_StoodInTop,tempStoodInTop
move.l PLR2_Roompt,tempRoompt
move.l #%010111100001,d7
move.w #-1,d0
move.l #0,targetydiff
move.l #$7fff,d1
move.l ZoneAdds,a3
move.l #PLR2_ObsInLine,a1
move.l ObjectData,a0
move.l #PLR2_ObjDists,a2
findclosestinline2
tst.w (a0)
blt outofline2
tst.b (a1)+
beq.s notlinedup2
btst #1,17(a0)
beq.s notlinedup2
tst.w 12(a0)
blt.s notlinedup2
move.b 16(a0),d6
btst d6,d7
beq.s notlinedup2
tst.b numlives(a0)
beq.s notlinedup2
move.w (a0),d5
move.w (a2,d5.w*2),d6
move.w 4(a0),d2
ext.l d2
asl.l #7,d2
sub.l PLR2_yoff,d2
move.l d2,d3
bge.s .oknotneg
neg.l d2
.oknotneg:
divs #40,d2
cmp.w d6,d2
bgt.s notlinedup2
cmp.w d6,d1
blt.s notlinedup2
move.w d6,d1
; We have a closer enemy lined up.
move.l d3,targetydiff
move.w d5,d0
notlinedup2:
add.w #64,a0
bra findclosestinline2
outofline2:
move.w #0,bulyspd
tst.w d0
blt nothingtoshoot2
move.l targetydiff,d5
sub.l PLR2_height,d5
add.l #18*256,d5
move.w d1,closedist
move.w BulletSpd,d2
asr.w d2,d1
tst.w d1
bgt.s okdistthing2
moveq #1,d1
okdistthing2
divs d1,d5
move.w d5,bulyspd
tst.b 5(a6)
beq pressedfire2
move.w (a6),d2
moveq #0,d1
move.b 2(a6),d1
cmp.w d1,d2
bge.s .okcanshoot
move.l PLR2_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.b #12,Samplenum+1
clr.b notifplaying
move.b #$fb,IDNUM
jsr MakeSomeNoise
rts
.okcanshoot:
move.w 8(a6),PLR2_TimeToShoot
move.b #2,PLR2_GunFrame
sub.w d1,d2
move.w d2,(a6)
; Just blow it up.
move.l PlayerShotData,a0
move.w #19,d1
.findonefree
move.w 12(a0),d2
blt.s .foundonefree
adda.w #64,a0
dbra d1,.findonefree
rts
.foundonefree:
move.l ObjectPoints,a1
move.w (a0),d2
move.l (a1,d0.w*8),(a1,d2.w*8)
move.l 4(a1,d0.w*8),4(a1,d2.w*8)
move.b #1,shotstatus(a0)
move.w #0,shotgrav(a0)
move.b p2_gunselected,shotsize(a0)
move.b #0,shotanim(a0)
move.l ObjectData,a1
asl.w #6,d0
adda.w d0,a1
move.w 4(a1),d1
ext.l d1
asl.l #7,d1
move.l d1,accypos(a0)
move.w 12(a1),12(a0)
st worry(a0)
move.w 4(a1),4(a0)
move.b 6(a6),d0
add.b d0,damagetaken(a1)
move.l PLR2_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.b 3(a6),Samplenum+1
move.b #2,chanpick
clr.b notifplaying
movem.l a0/d5/d6/d7,-(a7)
move.b #$fb,IDNUM
jsr MakeSomeNoise
movem.l (a7)+,a0/d5/d6/d7
rts
nothingtoshoot2:
tst.b 5(a6)
beq pressedfire2
move.w (a6),d0
moveq #0,d1
move.b 2(a6),d1
cmp.w d1,d0
bge.s .okcanshoot
move.l PLR2_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.b #12,Samplenum+1
clr.b notifplaying
move.b #$fb,IDNUM
jsr MakeSomeNoise
rts
.okcanshoot:
move.w 8(a6),PLR2_TimeToShoot
sub.w d1,d0
move.w d0,(a6)
move.b #2,PLR2_GunFrame
move.l PLR2_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.b 3(a6),Samplenum+1
move.b #2,chanpick
clr.b notifplaying
movem.l a0/d5/d6/d7,-(a7)
move.b #$fb,IDNUM
jsr MakeSomeNoise
movem.l (a7)+,a0/d5/d6/d7
rts
PLR2_nofire:
rts
tempyoff: dc.l 0
tempStoodInTop: dc.w 0
tempangpos: dc.w 0
tempxdir: dc.w 0
tempzdir: dc.w 0
tempgun: dc.w 0
tstfire: dc.w 0
pressedfire:
move.w #256,d6
move.w #256,d5
move.w (a6),d0
moveq #0,d1
move.b 2(a6),d1
cmp.w d1,d0
bge.s okcanshoot
move.l PLR1_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.b #12,Samplenum+1
clr.b notifplaying
move.b #$fb,IDNUM
jsr MakeSomeNoise
rts
okcanshoot:
move.w 8(a6),PLR1_TimeToShoot
sub.w d1,d0
move.w d0,(a6)
move.b #2,PLR1_GunFrame
move.l PLR1_Obj,a2
bra firefive
pressedfire2:
move.w #256,d6
move.w #256,d5
move.w (a6),d0
moveq #0,d1
move.b 2(a6),d1
cmp.w d1,d0
bge.s okcanshoot2
move.l PLR2_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.b #12,Samplenum+1
clr.b notifplaying
move.b #$fb,IDNUM
jsr MakeSomeNoise
rts
okcanshoot2:
move.w 8(a6),PLR2_TimeToShoot
sub.w d1,d0
move.w d0,(a6)
move.b #2,PLR2_GunFrame
move.l PLR2_Obj,a2
firefive:
move.l PlayerShotData,a0
move.w #19,d1
.findonefree
move.w 12(a0),d0
blt.s .foundonefree
adda.w #64,a0
dbra d1,.findonefree
rts
.foundonefree:
move.w 16(a6),shotgrav(a0)
move.w 18(a6),shotflags(a0)
move.w 20(a6),d0
add.w d0,bulyspd
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.b 3(a6),Samplenum+1
move.b #2,chanpick
clr.b notifplaying
move.b tempgun,shotsize(a0)
move.b 6(a6),shotpower(a0)
movem.l a0/d5/d6/d7,-(a7)
move.b #$fb,IDNUM
jsr MakeSomeNoise
movem.l (a7)+,a0/d5/d6/d7
move.l ObjectPoints,a1
move.w (a0),d1
lea (a1,d1.w*8),a1
move.w tempxoff,(a1)
move.w tempzoff,4(a1)
move.w tempxdir,d0
ext.l d0
move.w BulletSpd,d1
asl.l d1,d0
move.l d0,shotxvel(a0)
move.w tempzdir,d0
ext.l d0
asl.l d1,d0
move.l d0,shotzvel(a0)
move.w bulyspd,shotyvel(a0)
move.b tempStoodInTop,ObjInTop(a0)
move.w #0,shotlife(a0)
move.l d7,EnemyFlags(a0)
move.l tempRoompt,a2
move.w (a2),12(a0)
move.l tempyoff,d0
add.l #20*128,d0
move.l d0,accypos(a0)
st worry(a0)
asr.l #7,d0
move.w d0,4(a0)
add.w d6,tempangpos
neg.w d6
neg.w d5
add.w d5,d6
rts
PLR1_GunFrame: dc.w 0
PLR2_GunFrame: dc.w 0
duh: dc.w 0
double: dc.w 0
ivescreamed: dc.w 0
ObjectHandler:
move.l ObjectData,a0
Objectloop:
tst.w (a0)
blt doneallobj
tst.b worry(a0)
beq.s dontworryyourprettyhead
cmp.b #0,16(a0)
bne.s notnasty
bsr ItsANasty
notnasty:
cmp.b #1,16(a0)
bne.s notmedi
bsr ItsAMediKit
notmedi:
cmp.b #2,16(a0)
bne.s notbullet
bsr ItsABullet
notbullet:
cmp.b #3,16(a0)
bne.s notbiggun
bsr ItsABigGun
notbiggun:
cmp.b #4,16(a0)
bne.s notkey
bsr ItsAKey
notkey:
; FIVE IS PLAYER 1
cmp.b #6,16(a0)
bne.s notRobot
bsr ItsARobot
notRobot:
cmp.b #7,16(a0)
bne.s notBigNasty
bsr ItsABigNasty
notBigNasty:
cmp.b #8,16(a0)
bne.s notFlyingNasty
bsr ItsAFlyingNasty
notFlyingNasty:
cmp.b #9,16(a0)
bne.s notAmmoClip
bsr ItsAnAmmoClip
notAmmoClip
cmp.b #10,16(a0)
bne.s notBarrel
bsr ItsABarrel
notBarrel
; ELEVEN IS PLAYER 2
dontworryyourprettyhead:
adda.w #64,a0
bra Objectloop
doneallobj:
rts
include "ab3:source/AI.s"
ItsABarrel:
clr.b worry(a0)
cmp.w #8,8(a0)
bne.s notexploding
add.w #$404,6(a0)
move.w 10(a0),d0
add.w #1,d0
cmp.w #12+8,d0
bne.s .notdone
move.w #-1,12(a0)
rts
.notdone:
move.w d0,10(a0)
rts
notexploding:
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l ToZoneFloor(a1),d0
tst.b ObjInTop(a0)
beq.s .okinbot
move.l ToUpperFloor(a1),d0
.okinbot:
asr.l #7,d0
sub.w #32,d0
move.w d0,4(a0)
moveq #0,d2
move.b damagetaken(a0),d2
beq.s nodamage
move.b #0,damagetaken(a0)
sub.b d2,numlives(a0)
bgt.s nodamage
move.b #0,numlives(a0)
movem.l d0-d7/a0-a6,-(a7)
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),Viewerx
move.w 4(a1,d0.w*8),Viewerz
move.w #200,d0
jsr ComputeBlast
move.w (a0),d0
move.l #ObjRotated,a1
move.l (a1,d0.w*8),Noisex
move.w #300,Noisevol
move.w #15,Samplenum
jsr MakeSomeNoise
movem.l (a7)+,d0-d7/a0-a6
move.w #8,8(a0)
move.w #8,10(a0)
move.w #$1010,14(a0)
move.w #-30,2(a0)
rts
nodamage:
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),Viewerx
move.w 4(a1,d0.w*8),Viewerz
move.b ObjInTop(a0),ViewerTop
move.b PLR1_StoodInTop,TargetTop
move.l PLR1_Roompt,ToRoom
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l a1,FromRoom
move.w PLR1_xoff,Targetx
move.w PLR1_zoff,Targetz
move.l PLR1_yoff,d0
asr.l #7,d0
move.w d0,Targety
move.w 4(a0),Viewery
jsr CanItBeSeen
clr.b 17(a0)
tst.b CanSee
beq .noseeplr1
move.b #1,17(a0)
.noseeplr1:
rts
ItsAMarine:
move.w #15,Aggression
move.w #0,Movement
move.w #30,Cooperation
move.b #0,Ident
move.l #%1,enemies
move.l #%10100000,friends
st Armed
bsr AIControl
move.l objroom,a2
move.w 10(a2),2(a0)
move.l 2(a2),d0
sub.l #6400,d0
asr.l #7,d0
move.w d0,4(a0)
move.l #0,8(a0)
rts
include "ab3:source/aliencontrol.s"
nextCPt: dc.w 0
RipTear: dc.l 256*17*65536
otherrip: dc.l 256*18*65536
ItsAMediKit:
clr.b worry(a0)
HealFactor EQU 18
move.b PLR1_StoodInTop,d0
move.b ObjInTop(a0),d1
eor.b d1,d0
bne .NotSameZone
move.w PLR1_xoff,oldx
move.w PLR1_zoff,oldz
move.w PLR1_Zone,d7
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l ToZoneFloor(a1),d0
tst.b ObjInTop(a0)
beq.s .okinbot
move.l ToUpperFloor(a1),d0
.okinbot:
asr.l #7,d0
sub.w #16,d0
move.w d0,4(a0)
cmp.w 12(a0),d7
bne .NotSameZone
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),newx
move.w 4(a1,d0.w*8),newz
move.l #100*100,d2
bsr CheckHit
tst.b hitwall
beq.s .NotPickedUp
move.l PLR1_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.w #4,Samplenum
move.b #2,chanpick
clr.b notifplaying
move.b 1(a0),IDNUM
movem.l a0/a1/d2/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a1/d2/d6/d7
move.w #-1,12(a0)
move.w HealFactor(a0),d0
add.w d0,PLR1_energy
.NotPickedUp:
.NotSameZone:
MEDIPLR2
move.b PLR2_StoodInTop,d0
move.b ObjInTop(a0),d1
eor.b d1,d0
bne .NotSameZone
move.w PLR2_xoff,oldx
move.w PLR2_zoff,oldz
move.w PLR2_Zone,d7
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l ToZoneFloor(a1),d0
tst.b ObjInTop(a0)
beq.s .okinbot
move.l ToUpperFloor(a1),d0
.okinbot:
asr.l #7,d0
sub.w #16,d0
move.w d0,4(a0)
cmp.w 12(a0),d7
bne .NotSameZone
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),newx
move.w 4(a1,d0.w*8),newz
move.l #100*100,d2
bsr CheckHit
tst.b hitwall
beq.s .NotPickedUp
move.l PLR2_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.w #4,Samplenum
move.b #2,chanpick
clr.b notifplaying
move.b 1(a0),IDNUM
movem.l a0/a1/d2/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a1/d2/d6/d7
move.w #-1,12(a0)
move.w HealFactor(a0),d0
add.w d0,PLR2_energy
.NotPickedUp:
.NotSameZone:
rts
ItsAnAmmoClip:
clr.b worry(a0)
AmmoType EQU 18
move.b PLR1_StoodInTop,d0
move.b ObjInTop(a0),d1
eor.b d1,d0
bne .NotSameZone
move.w PLR1_xoff,oldx
move.w PLR1_zoff,oldz
move.w PLR1_Zone,d7
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l ToZoneFloor(a1),d0
tst.b ObjInTop(a0)
beq.s .okinbot
move.l ToUpperFloor(a1),d0
.okinbot:
asr.l #7,d0
sub.w #16,d0
move.w d0,4(a0)
cmp.w 12(a0),d7
bne .NotSameZone
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),newx
move.w 4(a1,d0.w*8),newz
move.l #100*100,d2
bsr CheckHit
tst.b hitwall
beq.s .NotPickedUp
move.l PLR1_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.w #11,Samplenum
clr.b notifplaying
move.b 1(a0),IDNUM
movem.l a0/a1/d2/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a1/d2/d6/d7
move.w #-1,12(a0)
move.w AmmoType(a0),d0
lea PLR1_GunData,a6
lsl.w #2,d0
lea (a6,d0.w*8),a6
moveq #0,d0
move.b 4(a6),d0
asl.w #3,d0
move.w (a6),d1
add.w d0,d1
move.w d1,(a6)
.NotPickedUp:
.NotSameZone:
AMMOPLR2:
move.b PLR2_StoodInTop,d0
move.b ObjInTop(a0),d1
eor.b d1,d0
bne .NotSameZone
move.w PLR2_xoff,oldx
move.w PLR2_zoff,oldz
move.w PLR2_Zone,d7
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l ToZoneFloor(a1),d0
tst.b ObjInTop(a0)
beq.s .okinbot
move.l ToUpperFloor(a1),d0
.okinbot:
asr.l #7,d0
sub.w #16,d0
move.w d0,4(a0)
cmp.w 12(a0),d7
bne .NotSameZone
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),newx
move.w 4(a1,d0.w*8),newz
move.l #100*100,d2
bsr CheckHit
tst.b hitwall
beq.s .NotPickedUp
move.l PLR2_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.w #11,Samplenum
clr.b notifplaying
move.b 1(a0),IDNUM
movem.l a0/a1/d2/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a1/d2/d6/d7
move.w #-1,12(a0)
move.w AmmoType(a0),d0
lea PLR2_GunData,a6
lsl.w #2,d0
lea (a6,d0.w*8),a6
moveq #0,d0
move.b 4(a6),d0
asl.w #3,d0
move.w (a6),d1
add.w d0,d1
move.w d1,(a6)
.NotPickedUp:
.NotSameZone:
rts
ItsABigGun:
clr.b worry(a0)
move.b PLR1_StoodInTop,d0
move.b ObjInTop(a0),d1
eor.b d1,d0
bne .NotSameZone
move.w PLR1_xoff,oldx
move.w PLR1_zoff,oldz
move.w PLR1_Zone,d7
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l ToZoneFloor(a1),d0
tst.b ObjInTop(a0)
beq.s .okinbot
move.l ToUpperFloor(a1),d0
.okinbot:
asr.l #7,d0
; add.w #16,d0
moveq #0,d1
move.b 7(a0),d1
sub.w d1,d0
move.w d0,4(a0)
cmp.w 12(a0),d7
bne .NotSameZone
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),newx
move.w 4(a1,d0.w*8),newz
move.l #100*100,d2
bsr CheckHit
tst.b hitwall
beq.s .NotPickedUp
move.l PLR1_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.w #4,Samplenum
move.b #2,chanpick
clr.b notifplaying
move.b 1(a0),IDNUM
movem.l a0/a1/d2/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a1/d2/d6/d7
move.l #Cheese,FacesPtr
move.w #4,Cheese
move.w #-1,FacesCounter
moveq #0,d0
move.b 17(a0),d0
lsl.w #2,d0
move.l #PLR1_GunData+32,a1
st 7(a1,d0.w*8)
move.w #-1,12(a0)
.NotPickedUp:
.NotSameZone:
GUNPLR2:
move.b PLR2_StoodInTop,d0
move.b ObjInTop(a0),d1
eor.b d1,d0
bne .NotSameZone
move.w PLR2_xoff,oldx
move.w PLR2_zoff,oldz
move.w PLR2_Zone,d7
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l ToZoneFloor(a1),d0
tst.b ObjInTop(a0)
beq.s .okinbot
move.l ToUpperFloor(a1),d0
.okinbot:
asr.l #7,d0
; add.w #16,d0
moveq #0,d1
move.b 7(a0),d1
sub.w d1,d0
move.w d0,4(a0)
cmp.w 12(a0),d7
bne .NotSameZone
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),newx
move.w 4(a1,d0.w*8),newz
move.l #100*100,d2
bsr CheckHit
tst.b hitwall
beq.s .NotPickedUp
move.l PLR2_Obj,a2
move.w (a2),d0
move.l #ObjRotated,a2
move.l (a2,d0.w*8),Noisex
move.w #50,Noisevol
move.w #4,Samplenum
move.b #2,chanpick
clr.b notifplaying
move.b 1(a0),IDNUM
movem.l a0/a1/d2/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a1/d2/d6/d7
move.l #Cheese,FacesPtr
move.w #4,Cheese
move.w #-1,FacesCounter
moveq #0,d0
move.b 17(a0),d0
lsl.w #2,d0
move.l #PLR2_GunData+32,a1
st 7(a1,d0.w*8)
move.w #-1,12(a0)
.NotPickedUp:
.NotSameZone:
rts
ItsAKey:
clr.b worry(a0)
move.b PLR1_StoodInTop,d0
move.b ObjInTop(a0),d1
eor.b d1,d0
bne .NotSameZone
move.w PLR1_xoff,oldx
move.w PLR1_zoff,oldz
move.w PLR1_Zone,d7
move.w 12(a0),d0
move.l ZoneAdds,a1
move.l (a1,d0.w*4),a1
add.l LEVELDATA,a1
move.l 2(a1),d0
asr.l #7,d0
sub.w #16,d0
move.w d0,4(a0)
cmp.w 12(a0),d7
bne .NotSameZone
move.w (a0),d0
move.l ObjectPoints,a1
move.w (a1,d0.w*8),newx
move.w 4(a1,d0.w*8),newz
move.l #100*100,d2
bsr CheckHit
tst.b hitwall
beq .NotPickedUp
move.w #0,Noisex
move.w #0,Noisez
move.w #50,Noisevol
move.w #4,Samplenum
move.b #2,chanpick
clr.b notifplaying
move.b 1(a0),IDNUM
movem.l a0/a1/d2/d6/d7,-(a7)
jsr MakeSomeNoise
movem.l (a7)+,a0/a1/d2/d6/d7
move.w #-1,12(a0)
move.b 17(a0),d0
or.b d0,Conditions+1
move.l #PanelKeys,a1
move.l #Panel+40*8*11+22,a2
moveq #0,d1
lsr.b #1,d0
bcs.s .done
addq #1,d1
lsr.b #1,d0
bcs.s .done
addq #1,d1
lsr.b #1,d0
bcs.s .done
addq #1,d1
.done
muls #6*22*8,d1
adda.w d1,a1
move.w #22*8-1,d0 ;lines
.lines:
move.l (a1)+,d1
or.l d1,(a2)
move.w (a1)+,d1
or.w d1,4(a2)
adda.w #40,a2
dbra d0,.lines
.NotPickedUp:
.NotSameZone:
rts
Conditions: dc.l 0
; Format of animations:
; Size (-1 = and of anim) (w)
; Address of Frame. (l)
; height offset (w)
Bul1Anim:
dc.w 30*256+30
dc.w 1,2
dc.w 0
dc.w 30*256+30
dc.w 1,17
dc.w 0
dc.w 30*256+30
dc.w 1,18
dc.w 0
dc.w 30*256+30
dc.w 1,19
dc.w 0
dc.l -1
Bul1Pop
dc.b 25,25
dc.w 1,6
dc.w 0
dc.b 25,25
dc.w 1,7
dc.w -4
dc.b 25,25
dc.w 1,8
dc.w -4
dc.b 25,25
dc.w 1,9
dc.w -4
dc.b 25,25
dc.w 1,10
dc.w -4
dc.b 25,25
dc.w 1,11
dc.w -4
dc.b 25,25
dc.w 1,12
dc.w -4
dc.b 25,25
dc.w 1,13
dc.w -4
dc.b 25,25
dc.w 1,14
dc.w -4
dc.b 25,25
dc.w 1,15
dc.w -4
dc.b 25,25
dc.w 1,16
dc.w -4
dc.l -1
Bul3Anim:
dc.b 25,25
dc.w 0,12
dc.w 0
dc.b 25,25
dc.w 0,13
dc.w 0
dc.b 25,25
dc.w 0,14
dc.w 0
dc.b 25,25
dc.w 0,15
dc.w 0
dc.l -1
Bul3Pop:
dc.l -1
Bul2Anim:
dc.b 25,25
dc.w 2,0
dc.w 0
dc.b 25,25
dc.w 2,1
dc.w 0
dc.b 25,25
dc.w 2,2
dc.w 0
dc.b 25,25
dc.w 2,3
dc.w 0
dc.b 25,25
dc.w 2,4
dc.w 0
dc.b 25,25
dc.w 2,5
dc.w 0
dc.b 25,25
dc.w 2,6
dc.w 0
dc.b 25,25
dc.w 2,7
dc.w 0
dc.w -1
Bul2Pop:
dc.b 25,25
dc.w 2,8
dc.w -4
dc.b 29,29
dc.w 2,9
dc.w -4
dc.b 33,33
dc.w 2,10
dc.w -4
dc.b 37,37
dc.w 2,11
dc.w -4
dc.b 41,41
dc.w 2,12
dc.w -4
dc.b 45,45
dc.w 2,13
dc.w -4
dc.b 49,49
dc.w 2,14
dc.w -4
dc.b 53,53
dc.w 2,15
dc.w -4
dc.b 57,57
dc.w 2,16
dc.w -4
dc.b 61,61
dc.w 2,17
dc.w -4
dc.b 65,65
dc.w 2,18
dc.w -4
dc.b 69,69
dc.w 2,19
dc.w -4
dc.w -1
RockAnim:
dc.b 16,16
dc.w 6,0
dc.w 0
dc.b 16,16
dc.w 6,1
dc.w 0
dc.b 16,16
dc.w 6,2
dc.w 0
dc.b 16,16
dc.w 6,3
dc.w 0
dc.l -1
RockPop:
dc.b 64,64
dc.w 8,0+8
dc.w 0
dc.b 72,72
dc.w 8,1+8
dc.w 0
dc.b 80,80
dc.w 8,2+8
dc.w 0
dc.b 88,88
dc.w 8,3+8
dc.w 0
dc.b 96,96
dc.w 8,4+8
dc.w 0
dc.b 104,104
dc.w 8,5+8
dc.w 0
dc.b 112,112
dc.w 8,6+8
dc.w 0
dc.b 120,120
dc.w 8,7+8
dc.w 0
dc.b 120,120
dc.w 8,8+8
dc.w 0
dc.b 120,120
dc.w 8,9+8
dc.w 0
dc.b 120,120
dc.w 8,10+8
dc.w 0
dc.b 120,120
dc.w 8,11+8
dc.w 0
dc.l -1
FlameAnim:
val SET 5
REPT 6
dc.b val,val
dc.w 1,2
dc.w 0
dc.b val+3,val+3
dc.w 1,17
dc.w 0
dc.b val+6,val+6
dc.w 1,18
dc.w 0
dc.b val+9,val+9
dc.w 1,19
dc.w 0
val SET val+12
ENDR
dc.l -1
FlamePop:
dc.b 40,40
dc.w 1,12
dc.w -8
dc.b 40,40
dc.w 1,13
dc.w -8
dc.b 40,40
dc.w 1,14
dc.w -8
dc.b 40,40
dc.w 1,15
dc.w -8
dc.b 40,40
dc.w 1,16
dc.w -8
dc.l -1
Explode1Anim:
dc.b 25,25
dc.w 0,16
dc.w 0
dc.b 25,25
dc.w 0,17
dc.w 0
dc.b 25,25
dc.w 0,18
dc.w 0
dc.b 25,25
dc.w 0,19
dc.w 0
dc.l -1
Explode1Pop:
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 20,20
dc.w 0,16
dc.w 1
dc.b 17,17
dc.w 0,16
dc.w 1
dc.b 13,13
dc.w 0,16
dc.w 1
dc.b 9,9
dc.w 0,16
dc.w 1
dc.l -1
Explode2Anim:
dc.b 20,20
dc.w 0,20
dc.w 0
dc.b 20,20
dc.w 0,21
dc.w 0
dc.b 20,20
dc.w 0,22
dc.w 0
dc.b 20,20
dc.w 0,23
dc.w 0
dc.l -1
Explode2Pop:
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 20,20
dc.w 0,20
dc.w 1
dc.b 17,17
dc.w 0,20
dc.w 1
dc.b 13,13
dc.w 0,20
dc.w 1
dc.b 9,9
dc.w 0,20
dc.w 1
dc.l -1
Explode3Anim:
dc.b 20,20
dc.w 0,24
dc.w 0
dc.b 20,20
dc.w 0,25
dc.w 0
dc.b 20,20
dc.w 0,26
dc.w 0
dc.b 20,20
dc.w 0,27
dc.w 0
dc.l -1
Explode3Pop:
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 17,17
dc.w 0,24
dc.w 1
dc.b 13,13
dc.w 0,24
dc.w 1
dc.b 9,9
dc.w 0,24
dc.w 1
dc.l -1
Explode4Anim:
dc.b 30,30
dc.w 0,28
dc.w 0
dc.b 30,30
dc.w 0,29
dc.w 0
dc.b 30,30
dc.w 0,30
dc.w 0
dc.b 30,30
dc.w 0,31
dc.w 0
dc.l -1
Explode4Pop:
dc.b 20,20
dc.w 0,28
dc.w 0
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 20,20
dc.w 0,28
dc.w 1
dc.b 17,17
dc.w 0,28
dc.w 1
dc.b 13,13
dc.w 0,28
dc.w 1
dc.b 9,9
dc.w 0,28
dc.w 1
dc.l -1
BulletSizes:
dc.w $808
dc.w $1010
dc.w $1010
dc.w $0808
dc.w $0808
dc.w 0,0,0,0,0
;10
dc.w 0,0,0,0,0,0,0,0,0,0
;20
dc.w 0,0,0,0,0,0,0,0,0,0
;30
dc.w 0,0,0,0,0,0,0,0,0,0
;40
dc.w 0,0,0,0,0,0,0,0,0,0
;50
dc.w $0808,$0808,$0808,$0808
HitNoises:
dc.l -1,-1
dc.w 15,200
dc.l -1,-1,-1,-1,-1,-1,-1
dc.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
dc.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
dc.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
dc.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
dc.w 13,50,13,50,13,50,13,50
ExplosiveForce:
dc.w 0,0,200,0,100,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0,0,0,0,0,0,0
dc.w 0,0,0,0
BulletTypes:
dc.l Bul1Anim,Bul1Pop
dc.l Bul2Anim,Bul2Pop
dc.l RockAnim,RockPop
dc.l FlameAnim,FlamePop
dc.l Bul1Anim,Bul1Pop
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l 0,0
dc.l Explode1Anim,Explode1Pop
dc.l Explode2Anim,Explode2Pop
dc.l Explode3Anim,Explode3Pop
dc.l Explode4Anim,Explode4Pop
tsta: dc.l 0
timeout: dc.w 0
ItsABullet:
move.b #0,timeout
move.w 12(a0),d0
blt doneshot
tst.b shotstatus(a0)
bne.s noworrylife
moveq #0,d1
move.w shotlife(a0),d2
blt.s infinite
move.b shotsize(a0),d1
move.l GunData,a1
lsl.w #2,d1
move.w 10(a1,d1.w*8),d1
blt.s infinite
cmp.w d2,d1
bge.s notdone
st timeout
bra.s infinite
notdone:
move.w TempFrames,d2
add.w d2,shotlife(a0)
infinite:
noworrylife:
move.w #0,extlen
move.b #$ff,awayfromwall
moveq #0,d1
move.b shotsize(a0),d1
move.l #BulletSizes,a1
move.w (a1,d1.w*2),14(a0)
move.l #BulletTypes,a1
lea (a1,d1.w*8),a1
moveq #0,d1
move.b shotanim(a0),d1
tst.b shotstatus(a0)
beq.s notpopping
move.l 4(a1),a2
move.w (a2,d1.w*8),d2
bge.s notdonepopping
move.w #-1,12(a0)
clr.b shotstatus(a0)
move.b #0,shotanim(a0)
rts
notdonepopping:
add.b #1,shotanim(a0)
move.w d2,6(a0)
move.l 2(a2,d1.w*8),8(a0)
move.w 6(a2,d1.w*8),d3
add.w d3,4(a0)
ext.l d3
asl.l #7,d3
add.l d3,accypos(a0)
rts
notpopping:
move.l (a1),a2
add.b #1,shotanim(a0)
move.w (a2,d1.w*8),d2
bge.s notdoneanim
move.b #0,shotanim(a0)
move.w #0,d1
notdoneanim:
move.w (a2,d1.w*8),6(a0)
move.l 2(a2,d1.w*8),8(a0)
move.w 6(a2,d1.w*8),d3
ext.l d3
asl.l #7,d3
add.l d3,accypos(a0)
move.l ObjectPoints,a1
move.w (a0),d1
lea (a1,d1.w*8),a1
move.l (a1),d2
move.l d2,oldx
move.l shotxvel(a0),d3
move.w d3,d4
swap d3
move.w TempFrames(pc),d5
muls d5,d3
mulu d5,d4
swap d3
clr.w d3
add.l d4,d3
add.l d3,d2
move.l d2,newx
move.l 4(a1),d2
move.l d2,oldz
move.l shotzvel(a0),d3
move.w d3,d4
swap d3
muls d5,d3
mulu d5,d4
swap d3
clr.w d3
add.l d4,d3
add.l d3,d2
move.l d2,newz
move.l accypos(a0),oldy
move.w shotyvel(a0),d3
muls TempFrames,d3
move.w shotgrav(a0),d5
beq.s nograv
muls TempFrames,d5
add.l d5,d3
move.w shotyvel(a0),d6
ext.l d6
add.l d5,d6
cmp.l #10*256,d6
blt.s okgrav
move.l #10*256,d6
okgrav:
move.w d6,shotyvel(a0)
nograv:
move.l accypos(a0),d4
add.l d3,d4
move.l d4,accypos(a0)
move.l d4,newy
asr.l #7,d4
move.w d4,4(a0)
move.l ZoneAdds,a2
move.l (a2,d0.w*4),d0
add.l LEVELDATA,d0
move.l d0,objroom
move.b ObjInTop(a0),StoodInTop
move.w #%0000010000000000,wallflags
move.l #0,StepUpVal
move.l #$1000000,StepDownVal
move.l #10*128,thingheight
movem.l d0/d7/a0/a1/a2/a4/a5,-(a7)
jsr MoveObject
movem.l (a7)+,d0/d7/a0/a1/a2/a4/a5
move.b StoodInTop,ObjInTop(a0)
tst.b hitwall
beq .nothitwall
move.l wallhitheight,d4
move.l d4,accypos(a0)
asr.l #7,d4
move.w d4,4(a0)
.hitsomething
clr.b timeout
move.b #0,shotanim(a0)
move.b #1,shotstatus(a0)
movem.l d0-d7/a0-a6,-(a7)
move.l #HitNoises,a2
moveq #0,d0
move.b shotsize(a0),d0
move.l (a2,d0.w*4),d0
blt.s .nohitnoise
move.l #ObjRotated,a1
move.w (a0),d1
move.l (a1,d1.w*8),Noisex
move.w d0,Noisevol
swap d0
move.w d0,Samplenum
move.b d1,IDNUM
jsr MakeSomeNoise
.nohitnoise:
moveq #0,d0
move.l #ExplosiveForce,a2
move.b shotsize(a0),d0
move.w (a2,d0.w*2),d0
beq.s .noexplosion
move.w newx,Viewerx
move.w newz,Viewerz
bsr ComputeBlast
.noexplosion:
movem.l (a7)+,d0-d7/a0-a6
; bra doneshot
; rts
.nothitwall:
tst.b timeout
bne .hitsomething
lab:
move.l objroom,a3
tst.b ObjInTop(a0)
beq.s .notintop
adda.w #8,a3
.notintop:
move.l 6(a3),d0
cmp.l accypos(a0),d0
blt .nohitroof
btst #0,shotflags+1(a0)
beq.s .nobounce
neg.w shotyvel(a0)
bra.s .nohitroof
.nobounce:
move.b #0,shotanim(a0)
move.b #1,shotstatus(a0)
movem.l d0-d7/a0-a6,-(a7)
move.l #HitNoises,a2
moveq #0,d0
move.b shotsize(a0),d0
move.l (a2,d0.w*4),d0
blt.s .nohitnoise
move.l #ObjRotated,a1
move.w (a0),d1
move.l (a1,d1.w*8),Noisex
move.w d0,Noisevol
swap d0
move.w d0,Samplenum
move.b d1,IDNUM
jsr MakeSomeNoise
.nohitnoise:
moveq #0,d0
move.l #ExplosiveForce,a2
move.b shotsize(a0),d0
move.w (a2,d0.w*2),d0
beq.s .noexplosion
move.w newx,Viewerx
move.w newz,Viewerz
bsr ComputeBlast
.noexplosion:
movem.l (a7)+,d0-d7/a0-a6
.nohitroof:
move.l 2(a3),d0
sub.l accypos(a0),d0
cmp.l #5*128,d0
bgt .nohitfloor
btst #0,shotflags+1(a0)
beq.s .nobounceup
tst.w shotyvel(a0)
blt .nohitfloor
moveq #0,d0
move.w shotyvel(a0),d0
asr.w #1,d0
neg.w d0
move.w d0,shotyvel(a0)
bra.s .nohitfloor
.nobounceup:
move.b #0,shotanim(a0)
move.b #1,shotstatus(a0)
movem.l d0-d7/a0-a6,-(a7)
move.l #HitNoises,a2
moveq #0,d0
move.b shotsize(a0),d0
move.l (a2,d0.w*4),d0
blt.s .nohitnoise2
move.l #ObjRotated,a1
move.w (a0),d1
move.l (a1,d1.w*8),Noisex
move.w d0,Noisevol
swap d0
move.w d0,Samplenum
move.b d1,IDNUM
jsr MakeSomeNoise
.nohitnoise2:
moveq #0,d0
move.l #ExplosiveForce,a2
move.b shotsize(a0),d0
move.w (a2,d0.w*2),d0
beq.s .noexplosion2
move.w newx,Viewerx
move.w newz,Viewerz
bsr ComputeBlast
.noexplosion2:
movem.l (a7)+,d0-d7/a0-a6
.nohitfloor:
move.l objroom,a3
move.w (a3),12(a0)
move.l newx,(a1)
move.l newz,4(a1)
************
* Check if hit a nasty
tst.l EnemyFlags(a0)
bne.s notasplut
rts
notasplut:
move.l ObjectData,a3
move.l ObjectPoints,a1
move.w newx,d2
sub.w oldx,d2
move.w d2,xdiff
move.w newz,d1
sub.w oldz,d1
move.w d1,zdiff
move.w d1,d3
move.w d2,d4
muls d2,d2
muls d1,d1
add.l d1,d2
beq .oksqr
move.w #31,d0
.findhigh
btst d0,d2
bne .foundhigh
dbra d0,.findhigh
.foundhigh
asr.w #1,d0
clr.l d3
bset d0,d3
move.l d3,d0
move.w d0,d1
muls d1,d1 ; x*x
sub.l d2,d1 ; x*x-a
asr.l #1,d1 ; (x*x-a)/2
divs d0,d1 ; (x*x-a)/2x
sub.w d1,d0 ; second approx
bgt .stillnot0
move.w #1,d0
.stillnot0
move.w d0,d1
muls d1,d1
sub.l d2,d1
asr.l #1,d1
divs d0,d1
sub.w d1,d0 ; second approx
bgt .stillnot02
move.w #1,d0
.stillnot02
move.w d0,d1
muls d1,d1
sub.l d2,d1
asr.l #1,d1
divs d0,d1
sub.w d1,d0 ; second approx
bgt .stillnot03
move.w #1,d0
.stillnot03
.oksqr
move.w d0,Range
add.w #40,d0
muls d0,d0
move.l d0,sqrnum
.checkloop:
tst.w (a3)
blt .checkedall
tst.w 12(a3)
blt .notanasty
move.b 16(a3),d1
move.l EnemyFlags(a0),d7
btst d1,d7
beq .notanasty
tst.b numlives(a3)
beq .notanasty
move.w 4(a3),d1
move.w 4(a0),d2
sub.w d1,d2
cmp.w #12+40,d2
bgt .notanasty
cmp.w #-12-40,d2
blt .notanasty
move.w (a3),d1
move.w (a1,d1.w*8),d2
move.w d2,d4
move.w 4(a1,d1.w*8),d3
move.w d3,d5
sub.w newx,d4
sub.w oldx,d2
move.w d2,d6
sub.w newz,d5
sub.w oldz,d3
move.w d3,d7
muls zdiff,d6
muls xdiff,d7
sub.l d7,d6
bgt.s .pos
neg.l d6
.pos:
divs Range,d6
cmp.w #50,d6
bgt .stillgoing
muls d2,d2
muls d3,d3
add.l d3,d2
cmp.l sqrnum,d2
bgt .stillgoing
muls d4,d4
muls d5,d5
add.l d5,d4
cmp.l sqrnum,d4
bgt .stillgoing
move.b shotpower(a0),d6
add.b d6,damagetaken(a3)
move.w shotxvel(a0),ImpactX(a3)
move.w shotzvel(a0),ImpactZ(a3)
move.b #0,shotanim(a0)
move.b #1,shotstatus(a0)
movem.l d0-d7/a0-a6,-(a7)
move.l #HitNoises,a2
moveq #0,d0
move.b shotsize(a0),d0
move.l (a2,d0.w*4),d0
blt.s .nohitnoise3
move.l #ObjRotated,a1
move.w (a0),d1
move.l (a1,d1.w*8),Noisex
move.w d0,Noisevol
swap d0
move.w d0,Samplenum
move.b d1,IDNUM
jsr MakeSomeNoise
.nohitnoise3:
moveq #0,d0
move.l #ExplosiveForce,a2
move.b shotsize(a0),d0
move.w (a2,d0.w*2),d0
beq.s .noexplosion3
move.w newx,Viewerx
move.w newz,Viewerz
bsr ComputeBlast
.noexplosion3:
movem.l (a7)+,d0-d7/a0-a6
bra .hitnasty
.stillgoing:
.notanasty:
add.w #64,a3
bra .checkloop
.hitnasty:
.checkedall
doneshot:
rts
tmpnewx: dc.l 0
tmpnewz: dc.l 0
hithit: dc.l 0
sqrnum: dc.l 0
tmpangpos: dc.l 0
putinbackdrop:
move.l a0,-(a7)
move.w tmpangpos,d5
and.w #8191,d5
muls #432,d5
divs #8192,d5
muls #38*2,d5
CACHE_ON d1
move.l frompt,a0
adda.w #104*4,a0
move.l #EndBackPicture,a3
lea.l BackPicture,a1
add.l d5,a1
move.w #2,d4
bra allbars
cnop 0,32
allbars:
move.w #31,d3
onebar:
vertline:
val SET 0
REPT 19
move.l (a1)+,d0
move.w d0,val+104*4(a0)
swap d0
move.w d0,val(a0)
val SET val+104*8
ENDR
cmp.l a3,a1
blt.s notoffrightend
move.l #BackPicture,a1
notoffrightend:
addq #4,a0
dbra d3,onebar
addq #4,a0
dbra d4,allbars
move.l (a7)+,a0
rts
ComputeBlast:
move.l #%110111100001,d7 ; possible targets
move.w d0,d6
move.w d0,d1
ext.l d6
asl.l #4,d6
move.w 12(a0),d0
neg.w d1
asr.w #5,d1
bsr Flash
move.l ZoneAdds,a2
move.l (a2,d0.w*4),a2
add.l LEVELDATA,a2
move.l a2,FromRoom
move.l ObjectData,a2
suba.w #64,a2
HitObjLoop:
add.w #64,a2
move.w (a2),d0
blt CheckedEmAll
tst.w 12(a2)
blt.s HitObjLoop
moveq #0,d1
move.b 16(a2),d1
btst d1,d7
beq.s HitObjLoop
move.w 12(a2),d1
move.l ZoneAdds,a3
move.l (a3,d1.w*4),a3
add.l LEVELDATA,a3
move.l a3,ToRoom
move.l ObjectPoints,a3
move.w (a3,d0.w*8),Targetx
move.w 4(a3,d0.w*8),Targetz
jsr CanItBeSeen
tst.b CanSee
beq.s HitObjLoop
move.w Targetx,d0
sub.w Viewerx,d0
move.w d0,d2
move.w Targetz,d1
sub.w Viewerz,d1
move.w d1,d3
muls d2,d2
muls d3,d3
add.l d2,d3
asr.l #6,d3
tst.w d3
bne.s OkItsnotzero
moveq #1,d3
OkItsnotzero:
cmp.l #32767,d3
bgt HitObjLoop
move.l d6,d5
divs d3,d5
cmp.w #50,d5
blt.s okdamage
move.w #50,d5
okdamage:
add.b d5,damagetaken(a2)
ext.l d0
asl.l #5,d0
ext.l d1
asl.l #5,d1
divs d3,d0
divs d3,d1
move.w d0,ImpactX(a2)
move.w d1,ImpactZ(a2)
bra HitObjLoop
CheckedEmAll:
rts